package com.yexuejc.docker.image;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@RestController
public class IndexCtrl {


    @RequestMapping("/exec")
    public void exec(String exec, HttpServletResponse response) throws IOException {
        response.setCharacterEncoding("UTF-8");
        PrintWriter printWriter = response.getWriter();
        System.out.println("EXEC：" + exec);
        printWriter.write("EXEC:" + exec + "\n");
        String[] execStr = exec.split(" ");
        Service service = new Service();
        service.exec(execStr, printWriter);
//        return Resps.success();
    }
}
